﻿package com.ouken.tool;

import com.ouken.activity.R;

public class Device {
	private String deviceSSID;
	private int deviceLogo;
	private int deviceName;
	private String deviceDescription;
	private int deviceSignal;
	private Boolean isOnline;
	private String devicePWD;
	private int[] deviceSignals = {0,
			                       R.drawable.signal1,
			                       R.drawable.signal2,
			                       R.drawable.signal3,
			                       R.drawable.signal4,
			                       R.drawable.signal5};
	
	public Device(String deviceSSID, String deviceDescription, int deviceSignal, String isOnline, String devicePWD) {
		super();
		this.deviceSSID = deviceSSID;
		String tmp = deviceSSID.substring(2, 4);
		this.isOnline = (isOnline.endsWith("1"))? true : false;
		if(this.isOnline){
			if(tmp.endsWith("01")){
				this.deviceLogo = R.drawable.icon_online_01;
				this.deviceName = R.string.device_name_01;
			}else if(tmp.endsWith("02")){
				this.deviceLogo = R.drawable.icon_online_02;
				this.deviceName = R.string.device_name_02;
			}else if(tmp.endsWith("03")){
				this.deviceLogo = R.drawable.icon_online_03;
				this.deviceName = R.string.device_name_03;
			}else if(tmp.endsWith("04")){
				this.deviceLogo = R.drawable.icon_online_04;
				this.deviceName = R.string.device_name_04;
			}else if(tmp.endsWith("05")){
				this.deviceLogo = R.drawable.icon_online_05;
				this.deviceName = R.string.device_name_05;
			}else if(tmp.endsWith("06")){
				this.deviceLogo = R.drawable.icon_online_06;
				this.deviceName = R.string.device_name_06;
			}else if(tmp.endsWith("07")){
				this.deviceLogo = R.drawable.icon_online_07;
				this.deviceName = R.string.device_name_07;
			}else if(tmp.endsWith("08")){
				this.deviceLogo = R.drawable.icon_online_08;
				this.deviceName = R.string.device_name_08;
			}else if(tmp.endsWith("09")){
				this.deviceLogo = R.drawable.icon_online_09;
				this.deviceName = R.string.device_name_09;
			}else if(tmp.endsWith("10")){
				this.deviceLogo = R.drawable.icon_online_10;
				this.deviceName = R.string.device_name_10;
			}else if(tmp.endsWith("11")){
				this.deviceLogo = R.drawable.icon_online_11;
				this.deviceName = R.string.device_name_11;
			}else if(tmp.endsWith("12")){
				this.deviceLogo = R.drawable.icon_online_12;
				this.deviceName = R.string.device_name_12;
			}else if(tmp.endsWith("13")){
				this.deviceLogo = R.drawable.icon_online_13;
				this.deviceName = R.string.device_name_13;
			}else if(tmp.endsWith("14")){
				this.deviceLogo = R.drawable.icon_online_14;
				this.deviceName = R.string.device_name_14;
			}
		}else{
			if(tmp.endsWith("01")){
				this.deviceLogo = R.drawable.icon_offline_01;
				this.deviceName = R.string.device_name_01;
			}else if(tmp.endsWith("02")){
				this.deviceLogo = R.drawable.icon_offline_02;
				this.deviceName = R.string.device_name_02;
			}else if(tmp.endsWith("03")){
				this.deviceLogo = R.drawable.icon_offline_03;
				this.deviceName = R.string.device_name_03;
			}else if(tmp.endsWith("04")){
				this.deviceLogo = R.drawable.icon_offline_04;
				this.deviceName = R.string.device_name_04;
			}else if(tmp.endsWith("05")){
				this.deviceLogo = R.drawable.icon_offline_05;
				this.deviceName = R.string.device_name_05;
			}else if(tmp.endsWith("06")){
				this.deviceLogo = R.drawable.icon_offline_06;
				this.deviceName = R.string.device_name_06;
			}else if(tmp.endsWith("07")){
				this.deviceLogo = R.drawable.icon_offline_07;
				this.deviceName = R.string.device_name_07;
			}else if(tmp.endsWith("08")){
				this.deviceLogo = R.drawable.icon_offline_08;
				this.deviceName = R.string.device_name_08;
			}else if(tmp.endsWith("09")){
				this.deviceLogo = R.drawable.icon_offline_09;
				this.deviceName = R.string.device_name_09;
			}else if(tmp.endsWith("10")){
				this.deviceLogo = R.drawable.icon_offline_10;
				this.deviceName = R.string.device_name_10;
			}else if(tmp.endsWith("11")){
				this.deviceLogo = R.drawable.icon_offline_11;
				this.deviceName = R.string.device_name_11;
			}else if(tmp.endsWith("12")){
				this.deviceLogo = R.drawable.icon_offline_12;
				this.deviceName = R.string.device_name_12;
			}else if(tmp.endsWith("13")){
				this.deviceLogo = R.drawable.icon_offline_13;
				this.deviceName = R.string.device_name_13;
			}else if(tmp.endsWith("14")){
				this.deviceLogo = R.drawable.icon_offline_14;
				this.deviceName = R.string.device_name_14;
			}
		}
		this.deviceSignal = this.deviceSignals[deviceSignal];
		this.deviceDescription = deviceDescription;
		this.devicePWD = devicePWD;
		
	}
	public String getDeviceSSID() {
		return deviceSSID;
	}
	public void setDeviceSSID(String deviceSSID) {
		this.deviceSSID = deviceSSID;
	}
	public int getDeviceLogo() {
		return deviceLogo;
	}
	public void setDeviceLogo(int deviceLogo) {
		this.deviceLogo = deviceLogo;
	}
	public int getDeviceName() {
		return deviceName;
	}
	public void setDeviceName(int deviceName) {
		this.deviceName = deviceName;
	}
	public String getDeviceDescription() {
		return deviceDescription;
	}
	public void setDeviceDescription(String deviceDescription) {
		this.deviceDescription = deviceDescription;
	}
	public int getDeviceSignal() {
		return deviceSignal;
	}
	public void setDeviceSignal(int deviceSignal) {
		this.deviceSignal = deviceSignal;
	}
	public Boolean getIsOnline() {
		return isOnline;
	}
	public void setIsOnline(Boolean isOnline) {
		this.isOnline = isOnline;
	}
	public String getDevicePWD() {
		return devicePWD;
	}
	public void setDevicePWD(String devicePWD) {
		this.devicePWD = devicePWD;
	}
	
	

}
